<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <link rel="stylesheet" href="../css/weui.css"/>
    <link rel="stylesheet" href="../css/weuix.css"/>

    <script src="../js/zepto.min.js"></script>
    <script>
        $(function(){


        });

    </script>
</head>

<body ontouchstart>
<div class="page-hd">
    <h1 class="page-hd-title">
        计数器
    </h1>
    <p class="page-hd-desc"></p>
</div>

<div class="weui-cells">
    <div class="weui-cell">
        <div class="weui-cell__bd">
            <p>优衣库轻薄羽绒服</p>
        </div>
        <div class="weui-cell__ft">
            <div class="weui-count">
                <a class="weui-count__btn weui-count__decrease"></a>
                <input class="weui-count__number" type="number" value="1" />
                <a class="weui-count__btn weui-count__increase"></a>
            </div>
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd"></div>
        <div class="weui-cell__bd">
            <p>三叶草男士运动鞋</p>
        </div>
        <div class="weui-cell__ft">
            <div class="weui-count">
                <a class="weui-count__btn weui-count__decrease"></a>
                <input class="weui-count__number" type="number" value="2" />
                <a class="weui-count__btn weui-count__increase"></a>
            </div>
        </div>
    </div>
    <div class="weui-cell weui-cell_swiped">
        <div class="weui-cell__bd">
            <div class="weui-cell">
                <div class="weui-cell__bd">
                    <p>袜子</p>
                </div>
                <div class="weui-cell__ft">
                    <div class="weui-count">
                        <a class="weui-count__btn weui-count__decrease"></a>
                        <input class="weui-count__number" type="number" value="1" />
                        <a class="weui-count__btn weui-count__increase"></a>
                    </div>
                </div>
            </div>
        </div>
        <div class="weui-cell__ft">
        </div>
    </div>
</div>

<script>
    var MAX = 99, MIN = 1;
    $('.weui-count__decrease').click(function (e) {
        var $input = $(e.currentTarget).parent().find('.weui-count__number');
        var number = parseInt($input.val() || "0") - 1
        if (number < MIN) number = MIN;
        $input.val(number)
    })
    $('.weui-count__increase').click(function (e) {
        var $input = $(e.currentTarget).parent().find('.weui-count__number');
        var number = parseInt($input.val() || "0") + 1
        if (number > MAX) number = MAX;
        $input.val(number)
    })
</script>
<br>
<br>
<div class="weui-footer weui-footer_fixed-bottom">
    <p class="weui-footer__links">
        <a href="../index.html" class="weui-footer__link">WeUI首页</a>
    </p>
    <p class="weui-footer__text">Copyright &copy; Yoby</p>
</div>
</body>
</html>